﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CoursePack;

namespace TheSchedulator.Forms
{
    public partial class frmMyAccount : Form
    {
        #region Data
        private Student m_Student;
        #endregion

        public frmMyAccount(Student _Student)
        {
            InitializeComponent();
            this.m_Student = _Student;
        }

        private void btnFindSchedule_Click(object sender, EventArgs e)
        {   
            Semester semester = this.m_Student.Degree.GetSemester(new Session((int)this.numericUpDown1.Value, (ESession)this.cmbSemesters.SelectedItem));
            if (semester != null)
            {
                ScheduleViewer attachedForm = new ScheduleViewer(this.m_Student, semester);

                attachedForm.ShowInTaskbar = false;
                attachedForm.TopLevel = true;
                attachedForm.ShowDialog();
            }
            else
                MessageBox.Show("No schedule have been found in your records matching the specified semester. \n Please review your selection !");
        }

        private void frmMyAccount_Load(object sender, EventArgs e)
        {
            // Load all possible Ession : Winter, Fall and Summer
            foreach (ESession sess in (ESession[])Enum.GetValues(typeof(ESession)))
            {
                this.cmbSemesters.Items.Add(sess);
            }

            this.cmbSemesters.SelectedIndex = 0;
        }
    }
}
